<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emp-toolkit: /Users/wangxiao/git/emp-toolkit/emp-tool/gc/garble_circuit.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo-full-doxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emp-toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('garble__circuit_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">garble_circuit.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="garble__circuit_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef GARBLE_CIRCUIT_H__</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define GARBLE_CIRCUIT_H__</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;block.h&quot;</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="utils_8h.html">utils.h</a>&quot;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div><div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377fe">    6</a></span>&#160;<span class="keyword">enum</span> <a class="code" href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377fe">RTCktOpt</a>{<a class="code" href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377feaf3be4933da71233c5904ec919ac1fdb0">on</a>, <a class="code" href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377fea53ace14c115e45153a1c9105accceb4c">off</a>};</div><div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="class_garble_circuit.html">    7</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_garble_circuit.html">GarbleCircuit</a> { <span class="keyword">public</span>:</div><div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a8f6b42bac3b5ce931d1d3eacb7db9d88">    8</a></span>&#160;    uint64_t <a class="code" href="class_garble_circuit.html#a8f6b42bac3b5ce931d1d3eacb7db9d88">gid</a> = 0;</div><div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a46e815c9fb7a86bd4f2f92480779a13b">    9</a></span>&#160;    bool (*<a class="code" href="class_garble_circuit.html#a46e815c9fb7a86bd4f2f92480779a13b">is_public_ptr</a>)(<a class="code" href="class_garble_circuit.html">GarbleCircuit</a>* gc, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> &amp; b, <span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a>);</div><div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a6615b1040a189cff8e434b9e0aace85b">   10</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> (*<a class="code" href="class_garble_circuit.html#a6615b1040a189cff8e434b9e0aace85b">public_label_ptr</a>)(<a class="code" href="class_garble_circuit.html">GarbleCircuit</a>* gc, <span class="keywordtype">bool</span> b);</div><div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#afccc6540c2627b73b87d6c5f84b88f1e">   11</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> (*<a class="code" href="class_garble_circuit.html#afccc6540c2627b73b87d6c5f84b88f1e">gc_and_ptr</a>)(<a class="code" href="class_garble_circuit.html">GarbleCircuit</a>* gc, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;a, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;b);</div><div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#afa9ba1e3231ce457c27271ab0f851014">   12</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> (*<a class="code" href="class_garble_circuit.html#afa9ba1e3231ce457c27271ab0f851014">gc_xor_ptr</a>)(<a class="code" href="class_garble_circuit.html">GarbleCircuit</a>*gc, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;a, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;b);</div><div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a21e46d460e571ba333ad682c92c4bd57">   13</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> (*<a class="code" href="class_garble_circuit.html#a21e46d460e571ba333ad682c92c4bd57">gc_not_ptr</a>)(<a class="code" href="class_garble_circuit.html">GarbleCircuit</a>*gc, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;a);</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;    </div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a4906885b2a74a49cea6bc08295fc0552">   15</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="class_garble_circuit.html#a4906885b2a74a49cea6bc08295fc0552">is_public</a>(<span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> &amp; b, <span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a>) {</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_garble_circuit.html#a46e815c9fb7a86bd4f2f92480779a13b">is_public_ptr</a>(<span class="keyword">this</span>, b, party);</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    }</div><div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a6783131e9ed70e69be48e8d6b2e9c8f4">   18</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> <a class="code" href="class_garble_circuit.html#a6783131e9ed70e69be48e8d6b2e9c8f4">public_label</a>(<span class="keywordtype">bool</span> b) {</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_garble_circuit.html#a6615b1040a189cff8e434b9e0aace85b">public_label_ptr</a>(<span class="keyword">this</span>, b);   </div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    }</div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a8e13369857f50cfaaea6ffb7881becf7">   21</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> <a class="code" href="class_garble_circuit.html#a8e13369857f50cfaaea6ffb7881becf7">gc_and</a>(<span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;a, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;b) {</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_garble_circuit.html#afccc6540c2627b73b87d6c5f84b88f1e">gc_and_ptr</a>(<span class="keyword">this</span>, a, b);</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    }</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#af6f5fa0971a5782608201c5a7f897df0">   24</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> <a class="code" href="class_garble_circuit.html#af6f5fa0971a5782608201c5a7f897df0">gc_xor</a>(<span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;a, <span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;b) {</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_garble_circuit.html#afa9ba1e3231ce457c27271ab0f851014">gc_xor_ptr</a>(<span class="keyword">this</span>, a, b);</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    }</div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a0c044174fe239a3ccc65b0854e06fb5a">   27</a></span>&#160;    <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> <a class="code" href="class_garble_circuit.html#a0c044174fe239a3ccc65b0854e06fb5a">gc_not</a>(<span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a>&amp;a) {</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_garble_circuit.html#a21e46d460e571ba333ad682c92c4bd57">gc_not_ptr</a>(<span class="keyword">this</span>, a);</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    }</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="class_garble_circuit.html#a86e55a9aa718d272c365dfd649fa97e1">   30</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> <a class="code" href="class_garble_circuit.html#a86e55a9aa718d272c365dfd649fa97e1">make_delta</a>(<span class="keyword">const</span> <a class="code" href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a> &amp; a) {</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        <span class="keywordflow">return</span> _mm_or_si128(<a class="code" href="utils_2block_8h.html#a371865208357f993ac4e691d54bd806d">makeBlock</a>(0L, 1L), a);</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    }</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;};</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#endif// GARBLE_CIRCUIT_H__</span></div><div class="ttc" id="class_garble_circuit_html_a86e55a9aa718d272c365dfd649fa97e1"><div class="ttname"><a href="class_garble_circuit.html#a86e55a9aa718d272c365dfd649fa97e1">GarbleCircuit::make_delta</a></div><div class="ttdeci">static block make_delta(const block &amp;a)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:30</div></div>
<div class="ttc" id="garble_2block_8h_html_a65abbf31b0a30290189cdb5059b5f785"><div class="ttname"><a href="garble_2block_8h.html#a65abbf31b0a30290189cdb5059b5f785">block</a></div><div class="ttdeci">__m128i block</div><div class="ttdef"><b>Definition:</b> block.h:8</div></div>
<div class="ttc" id="class_garble_circuit_html_af6f5fa0971a5782608201c5a7f897df0"><div class="ttname"><a href="class_garble_circuit.html#af6f5fa0971a5782608201c5a7f897df0">GarbleCircuit::gc_xor</a></div><div class="ttdeci">block gc_xor(const block &amp;a, const block &amp;b)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:24</div></div>
<div class="ttc" id="class_garble_circuit_html_a6783131e9ed70e69be48e8d6b2e9c8f4"><div class="ttname"><a href="class_garble_circuit.html#a6783131e9ed70e69be48e8d6b2e9c8f4">GarbleCircuit::public_label</a></div><div class="ttdeci">block public_label(bool b)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:18</div></div>
<div class="ttc" id="class_garble_circuit_html_a8f6b42bac3b5ce931d1d3eacb7db9d88"><div class="ttname"><a href="class_garble_circuit.html#a8f6b42bac3b5ce931d1d3eacb7db9d88">GarbleCircuit::gid</a></div><div class="ttdeci">uint64_t gid</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:8</div></div>
<div class="ttc" id="class_garble_circuit_html_afccc6540c2627b73b87d6c5f84b88f1e"><div class="ttname"><a href="class_garble_circuit.html#afccc6540c2627b73b87d6c5f84b88f1e">GarbleCircuit::gc_and_ptr</a></div><div class="ttdeci">block(* gc_and_ptr)(GarbleCircuit *gc, const block &amp;a, const block &amp;b)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:11</div></div>
<div class="ttc" id="utils_2block_8h_html_a371865208357f993ac4e691d54bd806d"><div class="ttname"><a href="utils_2block_8h.html#a371865208357f993ac4e691d54bd806d">makeBlock</a></div><div class="ttdeci">#define makeBlock(X, Y)</div><div class="ttdef"><b>Definition:</b> block.h:69</div></div>
<div class="ttc" id="class_garble_circuit_html_a6615b1040a189cff8e434b9e0aace85b"><div class="ttname"><a href="class_garble_circuit.html#a6615b1040a189cff8e434b9e0aace85b">GarbleCircuit::public_label_ptr</a></div><div class="ttdeci">block(* public_label_ptr)(GarbleCircuit *gc, bool b)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:10</div></div>
<div class="ttc" id="garble__circuit_8h_html_ae7d6f2e6bfde733807facd102cf377fe"><div class="ttname"><a href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377fe">RTCktOpt</a></div><div class="ttdeci">RTCktOpt</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:6</div></div>
<div class="ttc" id="garble__circuit_8h_html_ae7d6f2e6bfde733807facd102cf377feaf3be4933da71233c5904ec919ac1fdb0"><div class="ttname"><a href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377feaf3be4933da71233c5904ec919ac1fdb0">on</a></div><div class="ttdef"><b>Definition:</b> garble_circuit.h:6</div></div>
<div class="ttc" id="utils_8h_html"><div class="ttname"><a href="utils_8h.html">utils.h</a></div></div>
<div class="ttc" id="garble__circuit_8h_html_ae7d6f2e6bfde733807facd102cf377fea53ace14c115e45153a1c9105accceb4c"><div class="ttname"><a href="garble__circuit_8h.html#ae7d6f2e6bfde733807facd102cf377fea53ace14c115e45153a1c9105accceb4c">off</a></div><div class="ttdef"><b>Definition:</b> garble_circuit.h:6</div></div>
<div class="ttc" id="class_garble_circuit_html_a21e46d460e571ba333ad682c92c4bd57"><div class="ttname"><a href="class_garble_circuit.html#a21e46d460e571ba333ad682c92c4bd57">GarbleCircuit::gc_not_ptr</a></div><div class="ttdeci">block(* gc_not_ptr)(GarbleCircuit *gc, const block &amp;a)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:13</div></div>
<div class="ttc" id="class_garble_circuit_html_afa9ba1e3231ce457c27271ab0f851014"><div class="ttname"><a href="class_garble_circuit.html#afa9ba1e3231ce457c27271ab0f851014">GarbleCircuit::gc_xor_ptr</a></div><div class="ttdeci">block(* gc_xor_ptr)(GarbleCircuit *gc, const block &amp;a, const block &amp;b)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:12</div></div>
<div class="ttc" id="class_garble_circuit_html_a4906885b2a74a49cea6bc08295fc0552"><div class="ttname"><a href="class_garble_circuit.html#a4906885b2a74a49cea6bc08295fc0552">GarbleCircuit::is_public</a></div><div class="ttdeci">bool is_public(const block &amp;b, int party)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:15</div></div>
<div class="ttc" id="class_garble_circuit_html_a0c044174fe239a3ccc65b0854e06fb5a"><div class="ttname"><a href="class_garble_circuit.html#a0c044174fe239a3ccc65b0854e06fb5a">GarbleCircuit::gc_not</a></div><div class="ttdeci">block gc_not(const block &amp;a)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:27</div></div>
<div class="ttc" id="class_garble_circuit_html_a8e13369857f50cfaaea6ffb7881becf7"><div class="ttname"><a href="class_garble_circuit.html#a8e13369857f50cfaaea6ffb7881becf7">GarbleCircuit::gc_and</a></div><div class="ttdeci">block gc_and(const block &amp;a, const block &amp;b)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:21</div></div>
<div class="ttc" id="class_garble_circuit_html"><div class="ttname"><a href="class_garble_circuit.html">GarbleCircuit</a></div><div class="ttdef"><b>Definition:</b> garble_circuit.h:7</div></div>
<div class="ttc" id="class_garble_circuit_html_a46e815c9fb7a86bd4f2f92480779a13b"><div class="ttname"><a href="class_garble_circuit.html#a46e815c9fb7a86bd4f2f92480779a13b">GarbleCircuit::is_public_ptr</a></div><div class="ttdeci">bool(* is_public_ptr)(GarbleCircuit *gc, const block &amp;b, int party)</div><div class="ttdef"><b>Definition:</b> garble_circuit.h:9</div></div>
<div class="ttc" id="input-check-malicious_8cpp_html_aefdd5aa9f02e7cb8d21ea22b0e6b03df"><div class="ttname"><a href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a></div><div class="ttdeci">int party</div><div class="ttdef"><b>Definition:</b> input-check-malicious.cpp:12</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_eec959d81771dc8b1a750b834e1341eb.html">emp-tool</a></li><li class="navelem"><a class="el" href="dir_753dd0b08657245813d151abe49cc74f.html">gc</a></li><li class="navelem"><a class="el" href="garble__circuit_8h.html">garble_circuit.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
